import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '所属部门',
    align: "center",
    dataIndex: 'sysOrgCode'
  },
  {
    title: '健康管家二维码',
    align: "center",
    dataIndex: 'healthCode',
    customRender: render.renderImage,
  },
  {
    title: '护士管家二维码',
    align: "center",
    dataIndex: 'nurseCode',
    customRender: render.renderImage,
  },
  {
    title: '健康管家姓名',
    align: "center",
    dataIndex: 'healthName'
  },
  {
    title: '护士管家姓名',
    align: "center",
    dataIndex: 'nurseName'
  },
  {
    title: '健康管家电话',
    align: "center",
    dataIndex: 'healthTel'
  },
  {
    title: '护士管家电话',
    align: "center",
    dataIndex: 'nurseTel'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '所属部门',
    field: 'sysOrgCode',
    component: 'Input',
    dynamicDisabled: true
  },
  {
    label: '健康管家二维码',
    field: 'healthCode',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: '护士管家二维码',
    field: 'nurseCode',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: '健康管家姓名',
    field: 'healthName',
    component: 'Input',
  },
  {
    label: '护士管家姓名',
    field: 'nurseName',
    component: 'Input',
  },
  {
    label: '健康管家电话',
    field: 'healthTel',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: false},
              { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
             ];
    },
  },
  {
    label: '护士管家电话',
    field: 'nurseTel',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: false},
              { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  createBy: {title: '创建人',order: 0,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
  sysOrgCode: {title: '所属部门',order: 2,view: 'text', type: 'string',},
  healthCode: {title: '健康管家二维码',order: 3,view: 'image', type: 'string',},
  nurseCode: {title: '护士管家二维码',order: 4,view: 'image', type: 'string',},
  healthName: {title: '健康管家姓名',order: 5,view: 'text', type: 'string',},
  nurseName: {title: '护士管家姓名',order: 6,view: 'text', type: 'string',},
  healthTel: {title: '健康管家电话',order: 7,view: 'text', type: 'string',},
  nurseTel: {title: '护士管家电话',order: 8,view: 'text', type: 'string',},
};
